package com.tr.rentcar.model.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.tr.rentcar.model.bean.OrderService;
import com.tr.rentcar.model.jdbc.MySqlDb;
import com.tr.rentcar.model.jdbc.ResultHandler;

public class OrderServiceDao implements ResultHandler<OrderService> {
	MySqlDb db=MySqlDb.getInstance();
	
	@Override
	public OrderService doHander(Map<String, Object> row) {
		OrderService os=new OrderService();
		os.setOsId(Integer.parseInt(row.get("os_id")+""));
		os.setOsName(row.get("os_name")+"");
		os.setOsPrice(Double.parseDouble(row.get("os_price")+""));
		os.setOsPic(row.get("os_pic")+"");
		os.setOsDescribe(row.get("os_describe")+"");
		return os;
	}
	/**
	 * 获取所有服务选项
	 * @return
	 * @throws SQLException
	 */
	public List<OrderService> getAll() throws SQLException{
		String sql="select * from order_service";
		return db.executeQuery(sql, this);
	}

}
